#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "ui/UIButton.h"

class LifeGame : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();
	static const unsigned int NUM_SQUARE = 10;
	static const unsigned int NUM_PADDING_SQUARE = 10;

	static const unsigned int START_TAG = 0xFF;
	static const unsigned int END_TAG = 0xFE;

	static const unsigned int DIE_FLAG = 0x100000;
	static const unsigned int NEW_FLAG = 0x200000;

    virtual bool init();
    
    // a selector callback
    void menuCloseCallback(cocos2d::Ref* pSender);
	void startMenuCallback(cocos2d::Ref* pSender);
	void resetMenuCallback(cocos2d::Ref* pSender);
	void closeLabel(float dt);
	void calcuate(float dt);

    // implement the "static create()" method manually
    CREATE_FUNC(LifeGame);

private:
	float calculateSquareSize(float width, float heigth);
	int getBlackSqure(int i, int j);

private:
	cocos2d::LayerColor * mSquareMatrix[NUM_SQUARE][NUM_SQUARE] = {nullptr};
};

#endif // __HELLOWORLD_SCENE_H__
